/*
 * ChatRemindAction.java
 *
 * Created on 2007年5月18日, 下午1:22
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.ecomm.chat.action;

import com.ecomm.chat.manager.ChatMessageManager;
import com.ecomm.chat.manager.ChatRemindManager;
import com.ecomm.chat.pojo.ChatMessage;
import com.ecomm.chat.pojo.ChatRemind;
import com.ecomm.util.Logger;
import com.ecomm.platcore.struts.StrutsEntityAction;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * <p>Title: 易讯聊天系统</p>
 * <p>Description:
 *  易讯聊天系统
 * </p>
 * <p>Copyright: Copyright (c) 2007</p>
 * <p>Company: 联合易讯 </p>
 * @author <font color='blue'>pijunliang</font> &nbsp&nbsp<a href="mailto:pijunliang@hotmail.com">pijunliang@hotmail.com</a>
 * @version 1.0
 * @since 2007年5月18日, 下午1:22
 */
public class ChatRemindAction extends StrutsEntityAction<ChatRemind, ChatRemindManager> {
  private Log log = Logger.getLog(ChatMessageAction.class);
  private ChatRemindManager chatRemindManager;
  private ChatMessageManager chatMessageManager;
  public void setChatRemindManager(ChatRemindManager chatRemindManager) {
    this.chatRemindManager = chatRemindManager;
  }
  public void setChatMessageManager(ChatMessageManager chatMessageManager) {
    this.chatMessageManager = chatMessageManager;
  }
  /**
   *根据提醒ID，将提醒表的 状态更新
   */
  public ActionForward updateRemindStateWorkflow(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
    String id = request.getParameter("id");
    String state = request.getParameter("state");
    chatRemindManager.updateRemindStateWorkflow(id,state);
    return mapping.findForward(SUCCESS);
  }
  /**
   *这里的更新就需要先确定用户监听ID是多少
   *然后在修改提醒状态
   * 适用于 私聊中
   */
  public ActionForward getUnWorkFlow(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
    String senduerid = request.getParameter("senduerid");
    String sate= request.getParameter("sate");
    String parentid= request.getParameter("parentid");
    String acceptuserid= request.getParameter("acceptuserid");
    String type= request.getParameter("type");
    chatRemindManager.updateRemindState(senduerid,sate,parentid,acceptuserid,type,"2");
    return mapping.findForward(SUCCESS);
  }
}
